/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.List;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import pojo.Sanpham;
import util.MyHibernateUtil;

/**
 *
 * @author TT
 */
public class SanPhamDAO {
    public static List<Sanpham> layDanhSachSanPham() {
        List<Sanpham> list = null;
        SessionFactory sf = MyHibernateUtil.getSessionFactory();
        Session ss = sf.openSession();
        try {
            ss.beginTransaction();
            String hql = "from pojo.Sanpham";
            list = ss.createQuery(hql).list();
        }catch (Exception ex) {
            System.out.println(ex.getMessage());
        }
        return list;
    }
}
